using System.Data;
using ET;
namespace DAL
{
    public class Domain_DAL
    {
        private static readonly clsConnect cls = new clsConnect();

        #region Getdata

        public DataTable BindGirdDomain(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Domain_Search");
        }

        public DataTable BindGirdDomainDetail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Domain_ID", id);
            return cls.GetData("sp_tb_Domain_Detail");
        }

        public DataTable BindGirdDomainNational(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@National_ID", id);
            return cls.GetData("sp_tb_Domain_National");
        }

        public static DataTable GetDomainFillter(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@National_Id", id);
            return cls.GetData("sp_tb_Domain_Fillter");
        }
        #endregion

        #region Insert

        public bool InsertDomain(Domain_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@National_Id", data.National_Id);
            cls.AddParameter("@Domain_Alias", data.Domain_Alias);
            cls.AddParameter("@Domain_Name", data.Domain_Name);
            cls.AddParameter("@Domain_Note", data.Domain_Note);
            return cls.ExecuteNonQuery("sp_tb_Domain_Insert");
        }

        #endregion

        #region Update

        public bool UpdateDomain(Domain_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Domain_Id", data.Domain_Id);
            cls.AddParameter("@National_Id", data.National_Id);
            cls.AddParameter("@Domain_Alias", data.Domain_Alias);
            cls.AddParameter("@Domain_Name", data.Domain_Name);
            cls.AddParameter("@Domain_Note", data.Domain_Note);
            return cls.ExecuteNonQuery("sp_tb_Domain_Update");
        }

        #endregion

        #region Delete

        public bool DeleteDomain(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Domain_Id", id);
            return cls.ExecuteNonQuery("sp_tb_Domain_Delete");
        }

        #endregion
    }
}